Start recursively moving autocleanups macros to their headers
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 10 Nov 2015 13:59:36 +0000 (13:59 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Tue, 10 Nov 2015 13:59:36 +0000 (13:59 +0000)
* Cover letter

Having a single header file for all autocleanups definitions was a
reasonable stop-gap measure, but now GTK+ is starting to use G_DECLARE_*
macros. This means that every class using a G_DECLARE_* macro will need
to include "gtk.h" to avoid compiler warnings, which is not acceptable.

By moving the G_DEFINE_AUTO* use to the header that defines the type we
allow using the G_DECLARE_* macros without sacrificing the ability to
include only the needed files when deriving from a class.

* Commit

This commit changes all includes relative to GtkWindow to define their
own autocleanup macros.

gtk/gtk-autocleanups.h
gtk/gtkaccelgroup.h
gtk/gtkapplication.h
gtk/gtkbin.h
gtk/gtkborder.h
gtk/gtkcontainer.h
gtk/gtkwidget.h

index 60cccdd943a7c22fa90d8b04724e3198e8a314b5..089dd0a7354000288f9cc9a3aeb78d7a2fff74a2 100644 (file)
@@ -22,7 +22,6 @@
 #ifndef __GI_SCANNER__
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAboutDialog, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelLabel, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelMap, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccessible, g_object_unref)
@@ -33,11 +32,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooser, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserButton, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserDialog, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAppChooserWidget, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplicationWindow, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAspectFrame, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAssistant, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBin, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBox, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBuildable, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBuilder, g_object_unref)
@@ -68,7 +65,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserDialog, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkColorChooserWidget, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBox, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBoxText, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainer, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCssProvider, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDrawingArea, g_object_unref)
@@ -202,11 +198,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeView, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeViewColumn, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkViewport, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkVolumeButton, g_object_unref)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBorder, gtk_border_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPaperSize, gtk_paper_size_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSelectionData, gtk_selection_data_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextAttributes, gtk_text_attributes_unref)
index 7e5eaf1cb0ef701cd5a43b0a6dec1f54334fe975..ce117f182a9543cab8828787659cf11e836d26f2 100644 (file)
@@ -242,6 +242,10 @@ struct _GtkAccelGroupEntry
   GQuark       accel_path_quark;
 };
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref)
+#endif
+
 G_END_DECLS
 
 #endif /* __GTK_ACCEL_GROUP_H__ */
index b55d4a71a0a804306e0dd1548335dd370bd294c1..3cf905bdf767638954fc9e79278b7e3a5190a839 100644 (file)
@@ -162,6 +162,10 @@ GDK_AVAILABLE_IN_3_14
 GMenu *          gtk_application_get_menu_by_id                  (GtkApplication       *application,
                                                                   const gchar          *id);
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
+#endif
+
 G_END_DECLS
 
 #endif /* __GTK_APPLICATION_H__ */
index bca7885c5b687bb06fff5d82902492c6d131612c..63221402fd1c5062832f980e46f0b09f33705372 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <gtk/gtkcontainer.h>
 
-
 G_BEGIN_DECLS
 
 #define GTK_TYPE_BIN                  (gtk_bin_get_type ())
@@ -82,6 +81,10 @@ GtkWidget *gtk_bin_get_child (GtkBin *bin);
 void       _gtk_bin_set_child (GtkBin    *bin,
                                GtkWidget *widget);
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBin, g_object_unref)
+#endif
+
 G_END_DECLS
 
 #endif /* __GTK_BIN_H__ */
index b22ded7eca9d33583b41d9e586975363ec8f4283..362a7d00ba77e2ae8860a3c8c4b67d6f964f50c9 100644 (file)
@@ -65,6 +65,9 @@ GtkBorder *gtk_border_copy     (const GtkBorder *border_);
 GDK_AVAILABLE_IN_ALL
 void       gtk_border_free     (GtkBorder       *border_);
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBorder, gtk_border_free)
+#endif
 
 G_END_DECLS
 
index d6cc8ed5d285e04726cf9838d59a5fa74897e2d4..da75f349279fde2fff31b85095fc36d521f2cc5b 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <gtk/gtkwidget.h>
 
-
 G_BEGIN_DECLS
 
 #define GTK_TYPE_CONTAINER              (gtk_container_get_type ())
@@ -300,6 +299,10 @@ GDK_AVAILABLE_IN_ALL
 GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer      *container,
                                                   GtkWidget         *child);
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainer, g_object_unref)
+#endif
+
 G_END_DECLS
 
 #endif /* __GTK_CONTAINER_H__ */
index d428917062eb67be32faebd25b326f59c18189fc..208a9d1b4472bb17a4bce32bfa2104a09224e242 100644 (file)
@@ -1490,6 +1490,11 @@ void                    gtk_widget_set_font_map         (GtkWidget             *
 GDK_AVAILABLE_IN_3_18
 PangoFontMap *          gtk_widget_get_font_map         (GtkWidget             *widget);
 
+#ifndef __GI_SCANNER__
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
+#endif
+
 G_END_DECLS
 
 #endif /* __GTK_WIDGET_H__ */